﻿#pragma once
#include "ADFGlobal.h"
#include "AsPluginArgsBase.h"
#include <QMap>
#include <QLibrary>
#include <QFileInfo>
#include <QSharedPointer>

class AsPluginExecutor : public QObject {
private:
	AsPluginExecutor();

private:
	static QSharedPointer<AsPluginExecutor> ms_spInstance;

public:
	static QSharedPointer<AsPluginExecutor> getInstance();

private:
	QMap<QString, QLibrary*>	m_mpPlugins;						//插件map
	QString						m_qsPluginDir;						//插件路径

public:
	void loadPluginFileAndLib(QString libPath, QFileInfo& fileInfo, QLibrary* lib);
	//函数调用
	int execute(const AsPluginArgsAll& argsAll);
	//设置插件路径
	void setExecutePath(QString dir);

};

namespace As {

	int ADF_EXPORT callPluginFun(const AsPluginArgsAll& argsAll);
}


